package com.uyayo.framework.pagehelper.pojo;

import com.uyayo.framework.pagehelper.util.PageUtil;

/**
 * Created by hfj on 2017/6/26.
 */
public class PageOrderCondition {

    /**
     * 默认起始行
     */
    public static final int DEFAULT_OFFSET = 1;

    /**
     * 默认起始行
     */
    public static final int DEFAULT_LIMIT = 5;

    private Integer offset;

    private Integer limit;

    /**
     * 排序类型
     */
    private String sort;

    /**
     * 排序字段
     */
    private String order;

    public Integer getOffset() {
        return offset;
    }

    public void setOffset(Integer offset) {
        this.offset = offset;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public Integer getPageNum() {
        return offset!=null?offset:DEFAULT_OFFSET / PageUtil.checkPageSize(limit) + 1;
    }

    public Integer getPageSize() {
        return limit;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }


}
